home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / pas_0593.zip / AAMFUN.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-30  |  1KB  |  37 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 262 of 314
  3. From : Sean Palmer                         1:104/123.0          11 May 93  16:06
  4. To   : All
  5. Subj : Fun with AAM
  6. ────────────────────────────────────────────────────────────────────────────────
  7. I've been playing around with the AAM instruction and came up with some
  8. things you guys might find useful...}
  9.  
  10. function div10(b:byte):byte;assembler;asm
  11.  mov al,b; aam; mov al,ah;
  12.  end;
  13.  
  14. function mod10(b:byte):byte;assembler;asm
  15.  mov al,b; aam;
  16.  end;
  17.  
  18. type
  19.  str2=string[2];
  20.  str8=string[8];
  21.  
  22. function toStr2(b:byte):str2;assembler;asm {only call with b=0~99}
  23.  les di,@RESULT; cld; mov al,2; stosb;
  24.  mov al,b; aam; xchg ah,al; add ax,$3030; stosw;
  25.  end;
  26.  
  27. {makes date string in MM/DD/YY format from m,d,y}
  28. function toDateStr(m,d,y:byte):str8;assembler;asm {only call with m,d,y=0~99}
  29.  les di,@RESULT; cld; mov al,8; stosb;
  30.  mov al,m; aam; xchg ah,al; add ax,$3030; stosw;
  31.  mov al,'/'; stosb;
  32.  mov al,d; aam; xchg ah,al; add ax,$3030; stosw;
  33.  mov al,'/'; stosb;
  34.  mov al,y; aam; xchg ah,al; add ax,$3030; stosw;
  35.  end;
  36.  
  37. {strings as function results are WIERD with the inline Assembler. 8)}